package club.banyuan;

import javax.servlet.ServletException;
import javax.servlet.annotation.WebServlet;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import java.io.IOException;

@WebServlet(name = "Servlet3",urlPatterns = "/s3")
public class Servlet3 extends HttpServlet {
    protected void doPost(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {

    }

    protected void doGet(HttpServletRequest request, HttpServletResponse response) throws ServletException, IOException {
        // 设置属性
        request.setAttribute("userAge",20);
        request.getRequestDispatcher("/s2").forward(request,response);


        // 不加 "/" 路径为 /s3/index.jsp
        // 加 "/"  路径为 /index.jsp
//        request.getRequestDispatcher("/index.jsp").forward(request,response);
    }
}
